package com.xbongbong.pro.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

import java.util.Objects;

/**
 * @Author shian
 * @create 2019-08-26 13:37
 * @Description
 */
@Getter
public enum SoukeMealEnum {
    /**
     * 开通搜客套餐分类
     */
    SOUKE(1, "enum.soukeMeal.name.souke", "souke"),
    BUSINESS(2, "enum.soukeMeal.name.business", "business"),
    UNKNOW(404, "unknow", "unknow"),
    ;

   private Integer type;

   private String name;

   private String alias;


    SoukeMealEnum(Integer type, String name, String alias) {
        this.type = type;
        this.name = name;
        this.alias = alias;
    }

    public static SoukeMealEnum getByType(Integer type) {
        for (SoukeMealEnum soukeMealEnum : values()) {
            if (Objects.equals(soukeMealEnum.getType(), type)) {
                return soukeMealEnum;
            }
        }
        return UNKNOW;
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }
}
